<template>
  <div class="parent">
    <h2>使用 props 传递父子组件数据</h2>
    <button @click="counter++">add</button>
    <span v-if="toy">从子组件获取 {{ toy }}</span>
    <sub-comp :pin-money="counter" :send-toy="(v) => (toy = v)" />
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import SubComp from "./SubComp.vue";

const counter = ref(1);
const toy = ref("");

defineExpose({
  counter,
});
</script>

<style scoped>
@import "../common.css";
</style>
